<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #box{
      width: 200px;
      height: 200px;
      background-color: rgb(186, 203, 142);
      margin: 20px auto;
    }
    #box2{
      width: 200px;
      height: 200px;
      background-color: rgb(120, 142, 196);
      margin: 20px auto;
    }
    #box3{
      width: 200px;
      height: 200px;
      background-color: rgb(204, 180, 110);
      margin: 20px auto;
    }
  </style>
</head>
<body>
  <div id="app">
    <button @click="addNum">
      {{activeIndex}}
    </button>
    <div id="box" v-if="activeIndex%3 === 0">if</div>
    <div id="box2" v-else-if="activeIndex%3 === 1">else-if</div>
    <div id="box3" v-else>else</div>
  </div>
  <script src="./vue.global.js"></script>
  <script>
    // 创建 应用实例  app （mvvm中 vm）
    const { createApp } = Vue;
    // config 参数对象
    const app = createApp({
      data(){
        return {
          activeIndex: 0
        }
      },
      methods: {
        addNum () {
          this.activeIndex++;
        }
      }
    })
    // 渲染
    app.mount('#app')
  </script>
</body>
</html>